#include "stm32f10x.h"                  // Device header
#include "OLED.h"
#include "Delay.h"
#include "CountSensor.h"

int main(void)
{
	OLED_Init();
	CountSensor_Init();
	OLED_ShowString(1,1,"Count:");
	while(1)
	{
		OLED_ShowNum(1,7,CountSensor_Count_Get(),6);
		OLED_ShowString(2, 1, "Running");
		Delay_ms(100);
		OLED_ShowString(2, 1, "       ");
		Delay_ms(100);
		
		// 新增的"节能模式"(睡眠/停机)
		RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);		// 开启PWR的时钟
		PWR_EnterSTOPMode(PWR_Regulator_ON, PWR_STOPEntry_WFI);	// 电压调节器低功耗, 等待中断WFI
		SystemInit();											// 别忘了再开启HSE时钟
	}
}
